home *** CD-ROM | disk | FTP | other *** search
- Path: news.larc.nasa.gov!amiga-request
- From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
- Subject: v91i032: CShell 5.00 - alternative command interface, Part06/06
- Reply-To: <umueller@iiic.ethz.ch>
- Newsgroups: comp.sources.amiga
- Message-ID: <comp.sources.amiga:v91i032@ab20.larc.nasa.gov>
- References: <comp.sources.amiga:v91i027@ab20.larc.nasa.gov>
- Date: 03 Mar 91 21:56:07 GMT
- Approved: tadguy@uunet.UU.NET (Tad Guy)
- X-Mail-Submissions-To: amiga@uunet.uu.net
- X-Post-Discussions-To: comp.sys.amiga.misc
-
- Submitted-by: <umueller@iiic.ethz.ch>
- Posting-number: Volume 91, Issue 032
- Archive-name: shells/cshell-5.00/part06
-
- #!/bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 6 (of 6)."
- # Contents: shell.doc.aa
- # Wrapped by tadguy@ab20 on Sun Mar 3 16:56:02 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'shell.doc.aa' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'shell.doc.aa'\"
- else
- echo shar: Extracting \"'shell.doc.aa'\" \(34966 characters\)
- sed "s/^X//" >'shell.doc.aa' <<'END_OF_FILE'
- X
- X INSTRUCTIONS FOR SHELL VERSION: 5.00 17-Feb-91
- X ==============================================
- X
- X Contents
- X --------
- X
- X O. Installation
- X I. Description
- X II. Overview of Major features
- X III. Restrictions
- X IV. PIPES
- X V. Command Pre-processor
- X VI. Command Line Editing
- X VII. Function Keys
- X VIII. Shell Commands
- X IX. Special Set Variables
- X X. Functions
- X XI. Miscellaneous
- X XII. Example source files
- X XIII. Default values
- X XIV. Object oriented features
- X XV. Keymaps
- X
- X
- X
- XO. Installation
- X----------------
- X
- XYou can simply invoke csh from the command line or at the end of your
- Xstartup-sequence, because csh is, from the AmigaDOS standpoint, not a true
- Xshell like l:shell-seg. Nevertheless, csh is 'pure', so if your archiver
- Xforgot to set the 'p' bit, do it right now.
- X
- XIn order to run simple AmigaDOS batch files, you must make sure that they
- Xdon't use arguments (.key, .bra stuff), and you must replace ';' by ';#',
- Xso comments are comments both to AmigaDOS and CShell.
- X
- XProposed final setup: If you want to make csh resident, do the following:
- X
- XKickstart 1.3
- X1. Copy csh anywhere on your (hard)disk, e.g. dh1:tools
- X2. Make sure your s:startup-sequence contains:
- X Resident CLI L:Shell-Seg SYSTEM PURE ADD
- X Resident dh1:tools/csh ADD
- X NewCLI FROM s:csh-startup
- X EndCLI
- X3. Put the following in s:csh-startup
- X csh -r s:firstlogin.sh
- X4. In s:firstlogin.sh, put any commands to be called only once, like setmap,
- X assign, setclock. This is a shell script, use # for comments, and don't
- X use .key type commands. At the end of this file, add
- X source s:login.sh
- X5. In s:login.sh, you put any commands that need to be invocated on every
- X invocation, like 'alias', 'set' and so on.
- X6. Put the following the s:cli-startup and s:shell-startup, so csh will be
- X started in any window opened by NewCLI or from workbench.
- X csh s:login.sh
- X
- XKickstart 2.0
- X1. Copy csh anywhere on your (hard)disk, e.g. dh1:tools
- X2. Make sure your s:startup-sequence contains:
- X Resident dh1:tools/csh ADD
- X csh s:firstlogin.sh
- X3. Proceed from step 4 in kickstart 1.3
- X
- X
- X
- XI. DESCRIPTION
- X---------------
- X
- XThis version of Shell is the follow of:
- X Shell V2.04 (C)Copyright 1986, Matthew Dillon, All Rights Reserved
- X Shell V2.04M-V2.07M by Steve Drew
- X Shell V2.08MI, V3.xxA and V4.xxA by Carlo Borreo & Cesare Dieni
- X Shell V5.0x (and V4.9x) by Urban Mueller
- X
- XIf you have any wishes, bug reports or beer bottles, send them to:
- X
- X FIDONET: AUGL BBS, 2:302/906
- X USENET: umueller@iiic.ethz.ch
- Xor
- X Urban Mueller
- X Schulhausstrasse 83
- X CH-6312 Steinhausen
- X SWITZERLAND
- X
- XPlease check the 'restrictions' and 'known bugs' paragraphs before
- Xreporting any bugs. The support BBS is AUGL, +41 75 8 20 19, +41 75 8 20
- X18, +41 75 2 15 87 (all lines USRobotics HST) login='cshell',
- Xpassword='support'
- X
- XFor versions prior to 4.9 send suggestions/criticism/anything else to Carlo
- XBorreo or Cesare Dieni at:
- X
- X BITNET: PERUGIA@ICNUCEVM.BITNET
- X FIDONET: 2:332/602.0@FIDONET
- Xor
- X Carlo Borreo Cesare Dieni
- X Via G. Berio 34 Via G. Taddei 3
- X I-18100 Imperia I-56100 Pisa
- X Italy Italy
- X
- XYou may distribute this program unmodified and for non-profit only.
- X
- X*** YOU MAY NOT MODIFY THIS PROGRAM AND REDISTRIBUTE IT ***
- X
- XIf everyone writes his own version of Shell and distributes it, we would be
- Xcovered by Shell versions. If you make a modification to Shell that you
- Xwould like to share with other users, please send us a DIFF output, or a
- Xdescription of what you need.
- X
- XACKNOLEDGEMENTS
- X---------------
- X
- XArexx is a program by William Hawes.
- XCygnus Ed Professional (C) 1988 CygnusSoft Software.
- X
- X
- XII. OVERVIEW
- X------------
- X
- XShell provides a convenient AmigaDos alternative command interface. All its
- Xcommands are internal and thus does not rely on the c: commands for any
- Xfunctionality.
- X
- XMajor features include:
- X - command line editing
- X - simple history
- X - piping
- X - aliases with arguments
- X - variables & variable handling (embedded variables)
- X - file name expansion via wild carding ('?', '*' and more)
- X - conditionals (if/else etc..)
- X - source files (w/ gotos and labels)
- X - tab file name completion
- X - object oriented features (file classes, actions)
- X - many built in commands to speed things up
- X - full functionality on VT terminals
- X - freely programmable command line editing
- X
- XShell runs on minimum stack, for recursive aliases and source files better
- Xincrease stack to 8K or more.
- X
- XIf you use CShell for the first time, remember the following:
- X - CShell internal commands must be lowercase & can be abbreviated
- X - AmigaDOS command 'Execute' does not work, sorry. Use 'Newcli FROM',
- X 'run Execute' or slightly rewrite your scripts, so you can 'source'
- X them. Besides the '.'-Commands (.key,.bra), 'source' is downward
- X compatible to 'Execute'.
- X - You can always get more information on a command if shell.doc is
- X in the current directory (you will be able to modify this) and
- X you enter 'man <command>'
- X
- X
- XIII. RESTRICTIONS
- X-----------------
- X
- XResident AmigaDOS 2.0 CLI commands currently shouln't be started, even if you
- Xmake them resident yourself. According to a commodore official, this problem
- Xshould be fixed in the final kickstart 2.0 release. All INTERNAL residents
- Xare disabled for that reasons. If you have a kickstart version newer than
- X37.21, you might try to use the startup option -i, which enables the internal
- Xresidents. All other AmigaDOS residents can be started under DOS 2.0.
- X
- XUnder 1.3, you can't start AmigaDOS residents. But you can use the -r
- Xstartup option, which will copy the AmigaDOS resident list to the arp
- Xresident list once (and make those residents unremovable). I try to find a
- Xbetter solution.
- X
- XThe best choice is to make only csh itself AmigaDOS resident, all other
- Xcommands, if any, ARP resident. Under 1.3, you can start the shell (as all
- Xother commands) from resident only after you did 'resident CLI l:Shell-seg'
- Xand 'newcli'.
- X
- XVDK handler has a bug with setting file dates so when using the copy command
- Xand VDK you should use the -d switch otherwise your file date in vdk: will
- Xbe bad. (This is not a shell bug)
- X
- XIf using with conman it you may consider starting shell with the -a switch to
- Xturn off shell's command line editing and use conmans instead. You'll lose,
- Xhowever, many shell features like TAB file name completion.
- X
- XCB-handler (a tool that installs a scrollbar in the CLI window) is not 100%
- Xcompatible with the shell. The log will not always represent the true screen
- Xcontents.
- X
- X
- X
- XIV. NOTES ON PIPES
- X------------------
- X
- X PIPES
- X PIPES have been implemented using temporary T: files. Thus, you
- X should be careful when specifying a 't:*' expansion as it might
- X include the temporary files. These files are deleted on completion
- X of the pipe segment.
- X
- X The file names used are completely unique, even with multiple shell
- X running simultaneously.
- X
- X My favorite new feature is the fact that you can now redirect to
- X and from, and pipe internal commands. 'echo charlie >ram:x', for
- X instance. Another favorite:
- X
- X echo "echo mem | csh" | csh
- X
- X NO BCPL program should be output-append redirected (>>).
- X
- X
- XV. COMMAND PRE-PROCESSOR
- X-------------------------
- X
- X PREPROCESSING
- X Preprocessing is done on the command line before it is passed on to
- X an internal or external routine:
- X
- X ^c where c is a character is converted to that control character.
- X Thus, say '^l' for control-l.
- X
- X \233 insert character code 233 octal. Do not use values between
- X 200o and 232o, as they have special meanings. \240 is the
- X word separator.
- X
- X $name where name is a variable name. Variable names can consist of
- X 0-9, a-z, A-Z, and underscore (_). The contents of the
- X specified variable is used. If the variable doesn't exist,
- X the specifier is used. That is, if the variable 'i' contains
- X 'charlie', then '$i' -> 'charlie'. If the variable 'i' doesn't
- X exist, then '$i'->'$i' .
- X
- X ; delimits commands. echo charlie ; echo ben.
- X
- X ' ' (a space). Spaces delimit arguments.
- X
- X "string" a quoted string. Trailing quotes are optional. For instance,
- X if you want to echo five spaces and an 'a':
- X
- X echo a -> a
- X echo " a" -> a
- X
- X \c overide the meaning of special characters. '\^a' is a
- X circumflex and an a rather than control-a. To get a backslash,
- X you must say '\\'.
- X
- X also used to overide alias searching for commands.
- X
- X >file specify output redirection. All output from the command is
- X placed in the specified file.
- X
- X >>file specify append redirection (Does not work with BCPL programs).
- X
- X <file specify input redirection. The command takes input from the
- X file rather than the keyboard (note: not all commands require
- X input; it makes no sense to say 'echo <charlie' since
- X the 'echo' command only outputs its arguments).
- X
- X | PIPE specifier. The output from the command on the left becomes
- X the input to the command on the right. The current SHELL
- X implimentation uses temporary files to store the data.
- X
- X !! execute the previously executed command.
- X !nn (nn is a number). Insert the history command numbered n (see
- X the HISTORY command)
- X !partial search backwards through the history list for a command which
- X looks the same as 'partial', and execute it.
- X
- X # Enter comment. The rest of the line is discarded (note: \#
- X will, of course, overide the comment character's special
- X meaning)
- X
- X
- XVI. COMMAND LINE EDITING
- X------------------------
- X
- X o Command line can be up to 255 chars.
- X o Inserts and deletes are handled correctly over multiple screen
- X lines.
- X o Shell will keep track of the line width should the window get
- X resized.
- X
- X EDITING
- X
- X -- MOVING --
- X Left Arrow One character left
- X Right Arrow One character right
- X Shift-Left Arrow One word left
- X Shift-Right Arrow One word right
- X ESC-Left Arrow Beginning of line (^A) (^Z)
- X ESC-Right Arrow End of line (^E)
- X -- DELETING --
- X Backspace Previous character
- X Del Character under cursor
- X ESC-Backspace Previous word (^W)
- X ESC-Del Next word
- X ESC-x-Backspace To start of line (^B)
- X ESC-x-Del To end of line (^K)
- X ESC-d Entire line (^X)
- X -- HISTORY --
- X Up Arrow Recall previous commands
- X Down Arrow Recall commands
- X Shift-Up Arrow Get start of history
- X Shift-Down Arrow Get end of history
- X ESC-! Get history from partial (or number)
- X ^T Insert tail (all but first word) of previous line
- X -- COMPLETION --
- X TAB Inserts first matching file name
- X Shift-TAB Inserts longest common substring
- X ESC-TAB Inserts all matching file names
- X ESC-c Does a quick cd on left word (TAB for cycling)
- X ESC-~ Inserts the last current directory
- X -- EXECUTING LINE --
- X Return Executes line
- X ESC-Return Executes this line of history & brings up next one
- X ^N Next line. Don't exec this one but store history
- X ^\ EOF (directly exits)
- X -- MISCELLANEOUS --
- X ^L Retype current line.
- X ^O Echo a ^O
- X ^R Repeat last command (don't play with this)
- X ^U Undo/Redo last edit
- X ESC-i Toggle Insert/Overwrite
- X f1-f10 Execute command if variable exists.
- X F1-F10 More commands (Shifted f keys).
- X Help Invokes help command
- X
- XWhenever the cursor is placed on or directly after an incomplete file name
- Xand you press TAB, CShell inserts for the first filename (sorted
- Xalphabetically) that matches the name part already typed. Any wildcards
- Xare allowed here, if none are given, '*' is appended. Immediately pressing
- XTAB again brings up the next file name that matched the substring.
- XShift-TAB will only insert the as much as is common to all files that
- Xmatched you abbreviation. If pressed again, behaves just like TAB.
- XESC-Tab inserts the name of the directory where you would have ended up
- Xwith a quick cd to that substring.
- X
- XNote that ^D now means 'quit batchfile' like under AmigaDOS and is no
- Xlonger used for quitting CShell. If you want it back, enter 'keymap 0 4=41'
- X
- XThe CTRL keys FGPVY are unset, feel free to map them to any function (see
- Xchapter XV). You can also remap all preset keys.
- X
- XVII. FUNCTION KEYS
- X------------------
- X
- X FUNKEY
- X Function keys now insert text to the current position on the command
- X line. They maybe terminated with a ^M (return). f1 would be non shifted
- X where as F1 is shifted.
- X Most of functions key have a default definition, but it may be changed.
- X
- X $ set f1 dir df0:^M
- X
- X will add the text 'dir df0:<return>' to the current line.
- X
- X $ set f1 dir
- X
- X would only add 'dir' you could then enter ' df0:<return>'
- X
- X
- XVIII. SHELL COMMANDS
- X--------------------
- X
- X STARTUP OPTIONS
- X First to start shell from a CLI:
- X
- X shell [-abkntv] [-c command;command]
- X
- X -a AUX: mode. No command line editing and text highlighting
- X -b starts shell in background, which means only task priority -1.
- X -c allows execution of one command line and then exits out
- X of shell. This is useful for running an internal shell
- X commands in the background or from an external application:
- X Run csh -c dir df0:; copy -r df0: df1: >nil:; echo Done
- X -f starts shell in foreground, which means only task priority 1.
- X you should reset this prioritiy to 0 at the end of your .login
- X -k sets _nobreak before doing anything
- X -n suppresses starting of s:.login
- X -r copies the amiga resident list to the arp resident list. You
- X can't remove them anymore. INTERNAL residents can't be copied.
- X This option will be ignored under kickstart 2.0
- X -t terminal mode. You can use command line editing and text high-
- X lighting on a VT100 compatible terminal.
- X -v sets _verbose before doing anything.
- X
- X Under 1.3, the best thing you can do is to make csh resident using
- X the AmigaDOS Resident command in the startup-sequence, then start
- X it with the option -r, so you can start another resident csh from
- X inside csh. NOTE: Residents copied using -r cannot be removed! I
- X advise you to use the internal resident command for all but csh
- X itself.
- X
- X COMMAND EXECUTION
- X
- X Internal shell commands are case sensitive and may be abreviated.
- X
- X The first argument is the command-name... here is (in order) how Shell
- X tries to execute it:
- X
- X 1) Alias list is searched for an alias exactly matching name.
- X 2) Internal commands list is scanned for a command even partially
- X matching name (so you can, for instance, say resi for resident;
- X however, you should specify enough of a command to be unique).
- X 3) Then, the list of functions is scanned for a command that
- X matches completely. If one is found, the result of the function
- X is echoed to stdout.
- X 4) AmigaDOS and ARP resident list are scanned (you can use Shell's
- X resident command to add/remove a file in the ARP list).
- X 5) At this point, command is supposed to be external (disk).
- X 6) If the file is a directory, a 'cd' is performed to it.
- X 7) If the file is in the current directory and it's executable, it
- X is started. If not executable but has the 's' bit set, it's
- X 'source'd.
- X 8) Then it is searched in the AmigaDOS path and c:
- X 9) Now, the shell path ($_path) is searched. If it's found and
- X executable, it's be started. If it has the 's' bit set, it will
- X be 'source'd.
- X 10) Next, AUTOMATIC SOURCING is tried, first in current directory,
- X then in Shell path.
- X 11) Then the variable _rxpath is examined. If it exists, and the
- X current file with the suffix .rexx exists in one of the
- X directories specified in _rxpath, 'RX <file>' is executed.
- X 12) If all failed, an 'exec' action is sent to the file. See chapter
- X XIV for more info on classes and actions.
- X
- X To enforce that the external 'dir'-command is used, enter 'Dir'. Tt
- X is a good habit to uppercase the first letter of all external com-
- X mands, even if this is not necessary.
- X
- X AUTOMATIC SOURCING may be accomplished by naming shell scripts with
- X a .sh suffix. Thus, if you say 'stuff' and the file 'stuff.sh'
- X exists in your current or anywhere in Shell search path (NOTE: won't
- X be found in the AmigaDOS path), it will be SOURCED with all arguments
- X you have given placed in the $_passed variable. This is equivalent
- X to typing 'source stuff.sh'
- X
- X WILD CARD EXPANSION
- X Most shell commands will accept multiple arguments that can
- X be as a result of wild card expansion. Also when calling
- X an external command shell will first expand any wild cards
- X to separate arguments. If you wish to have the external command
- X handle it's own wild carding you will need to insert quotes
- X around the special wild card characters or use an alias (see
- X explanation of 'alias')
- X
- X eg.
- X arc a new.arc *.txt - shell will expand and pass to arc
- X arc a new.arc "*.txt" - let arc expand the wild cards.
- X alias arc "*a Arc $a" - now shell will never expand
- X
- X Wildcards allowed:
- X
- X ? match any single character
- X * match any string
- X .../* recursive search down ALL sub directories from current level
- X ~ exclude pattern matching specifier
- X ! synonim for ~, supported for compatibility
- X & prefixed to patterns, ask confirmation for each file
- X [] character class
- X ~ the previous current directory
- X Note that a pattern must contain a '?' or a '*', otherwise the other
- X special characters are not recognized. Furthermore, you cannot spe-
- X cify a single '?' as a pattern in the first argument to a command,
- X as this will show you the usage of that command.
- X
- X Examples:
- X
- X df0:.../* all files in all directories on df0:
- X df0:.../!*.info full directory tree of df0: but exclude
- X any ugly .info files.
- X !*.o !*.c will result in ALL files matching since what
- X doesn't match the !*.o will match the !*.c
- X df1:&* all files in root of df1:, but ask
- X confirmation for each
- X *.[co] all files ending in .c or .o
- X ~*.[co] all files NOT ending in .c nor in .o
- X ~/readme the readme from your last current directory
- X
- X Note that some commands prevent wild card expansion. These are:
- X - dir, rpn, whereis, window
- X Those commands will expand the wild cards themselves. This is why
- X dir @without( *.? , *.o )
- X will not work. Instead use:
- X set arg @without( *.? , *.o );dir $arg
- X
- X There is one exception to the rules given above: A single '?' as
- X the first argument will *not* expand in order to allow you to get
- X the usage of CLI and csh commands easily.
- X
- X The following symbols are not yet supported by wild card
- X expansions, but are accepted in search -w:
- X
- X ( | ) OR matching
- X # 0 or more times the pattern following
- X
- X Examples:
- X
- X "k#a" matches ka, kaa, kaaa, etc.
- X "hel(lo|p)" matches hello or help.
- X
- X
- XLIST OF COMMANDS:
- X-----------------
- X
- X ABORTLINE
- X Usage : abortline
- X Example : echo a;abort;echo b
- X Results : a
- X
- X Causes the rest of the line to be aborted. Intended for use in
- X conjunction with exception handling.
- X
- X ACTION
- X Usage : action [-a] actionname file [arguments]
- X
- X Sends an action to a file. See chapter XIV CLASSES
- X Options:
- X -a (abort) returns 0 if failed and 1 if successful. Otherwise,
- X normal error codes (10 or 11) are returned
- X
- X ADDBUFFERS
- X Usage : addbuffers drive buffers [drive buffers ...]
- X Example : addbuffers df0: 24
- X
- X Just like AmigaDOS addbuffer command, causes new buffers to be
- X allocated for disk I/O. Each buffer costs 512 bytes of memory,
- X CHIP memory if a disk drive.
- X
- X ALIAS
- X Usage : alias [name [command string] ]
- X Example : alias vt "echo Starting VT100;run sys:tools/vt100"
- X
- X Sets a name to be a string. You can alias a single name to a set
- X of commands if you enclose them in quotes as above. By simply
- X typing vt, the command line above would be executed.
- X
- X Argument Passing to an Alias:
- X
- X Usage : alias name "%var[%var...] [ command_string ]"
- X alias name "*var[%var...] [ command_string ]"
- X Example : alias xx "%q%w echo hi $q, you look $w
- X xx Steve great today
- X Results : hi Steve, you look great today
- X
- X The second form of the alias command allows passing of arguments
- X to any position within the command string via use of a variable
- X name. To pass arguments to the end of a command string this method
- X is actually not necessary. Note that these variables are not (yet)
- X local, so make sure don't destroy another variable.
- X If you specify multiple arguments, every argument will be assigned
- X one word, and the last one will be assigned the rest of the command
- X line.
- X
- X Using a '*' instead of the first '%' prevents wild card expansion:
- X alias zoo "*a zoo $a
- X To expand the wild cards after you got them, use
- X exec set a $a
- X
- X By typing "alias name", you will get the alias for that name, while
- X with "alias" you get a list of all alias.
- X
- X ASCII
- X Usage : ascii
- X ascii string
- X
- X If called without arguments, ascii outputs a complete ascii table.
- X Given a string, shows each character in ascii. Options:
- X -h shows numbers in hexadecimal
- X -o shows numbers in octal
- X
- X ASET
- X Usage : aset name value
- X Example : aset INCLUDE include:
- X
- X Set a variable in a way that is compatible with ARP/old Aztec set
- X command; this is completely different from ENV: Shell variable.
- X
- X ASSIGN
- X Usage : assign
- X assign logical
- X assign [-ln] logical1 physical1 [logical2 physical2 ... ]
- X
- X The first form shows all assigns.
- X The second form kills one assign.
- X The third form assigns logical1 to physical1 and so on. Options:
- X -l creates a late-binding assign under kick 2.0, ignored otherwise
- X -n creates a non-binding assign under kick 2.0, ignored otherwise
- X For definition of late/nonbinding, refer to your AmigaDOS manual.
- X
- X BASENAME
- X Usage : basename var path
- X Example : basename x df0:c/Dir # sets x to "Dir"
- X
- X Sets var specified to basename of path.
- X
- X CAT
- X Usage : cat [-n][file file....]
- X Example : cat foo.txt
- X
- X Type the specified files onto the screen. If no file is specified,
- X STDIN in used (note: ^\ is EOF). CAT is meant to output text files
- X only. Specifying -n option you will get numbered lines.
- X
- X CD
- X Usage : cd [path]
- X cd -g device1 [device2 [device3 ...]]
- X
- X Change your current working directory. You may specify '..' to go
- X back one directory (this is a CD specific feature, and does not
- X work with normal path specifications).
- X
- X In most cases, you'll no more have to use the CD command. Just type
- X the desired directory at the prompt (very handy in conjunction with
- X file name completion). Typing a ~ alone on a command line cd's
- X to prevous current directory.
- X
- X There are two situations left when you still need it:
- X
- X Entering 'cd *tem' will cd to the first name matched.
- X
- X The second form generates a list (an ascii file) of all direc-
- X tories on the given devices. It will be stored in the file given
- X in $_qcd (default: 'S:csh-qcd'). Note that this ascii file will
- X not be merged but overwritten. Once you have generated this file,
- X you can cd to any directory on your harddisk(s) even if it's not
- X in the current directory.
- X If you have two directories of the same name and you use one of
- X them more, move the more important one to the beginning of the
- X qcd file. You might also sort the file.
- X It is legal to type just an abbreviation of the directory name
- X you want to cd to. No asterisk '*' necessary. If you end up in
- X the wrong directory, cd to the same directory again (best done
- X by Cursor-Up + RETURN). You will cycle through all directories
- X that matched the given abbreviation. The other possibility is to
- X specify the full name of the parent directory: cd devs/keym
- X You may also add devices and assigns, so if 'PageStream:' is one
- X line in the qcd-file, a cd to 'page' is successful.
- X
- X CD without any arguments displays the path of the directory you
- X are currently in.
- X
- X CLASS
- X Usage : [-n] name {type=param} [ "actions" {action=command} ]
- X Example : class zoo offs=20,dca7c4fd ext=.zoo actions view="zoo l"
- X
- X Defines a new class of files and the actions to be taken on them
- X in various cases, or shows old definitions if given no arguments.
- X See section XIV: OBJECTS
- X Options:
- X -n (new) forgets old definitions
- X
- X
- X CLOSE
- X Usage : close [filenumber]
- X
- X Close the specified file opened by open. Without filenumber, closes
- X all open files. See open and flist for more info.
- X
- X CLS
- X Usage : cls
- X
- X This is an alias. It only clears the screen, but also works on a
- X terminal (e ^L doesn't).
- X
- X COPY (CP)
- X Usage : copy [-udfp] file file
- X or : copy [-udfp] file1 file2...fileN dir
- X or : copy [-rudfp] dir1...dirN file1...fileN dir
- X
- X Options :
- X -r recursive, copy all subdirectories as well.
- X -u update, if newer version exists on dest, don't copy
- X -f freshen, if file doesn't exist on dest or newer, don't copy
- X -d don't set destination file date to that of source.
- X -p don't set destination protection bits to those of source.
- X
- X Example : copy -r df0: df1:
- X
- X Copy files or directories. When copying directories, the -r option
- X must be specified to copy subdirectories as well. Otherwise, only
- X top level files in the source directory are copied.
- X
- X All files will be displayed as they are copied and directory's
- X displayed as they are created. This output can be suppessed by
- X redirecting to nil: eg. copy -r >nil: df0: df1:
- X
- X Copy will abort after current file on Control-C.
- X
- X Copy by default sets the date of the destination file to that of
- X the source file. To overide this feature use the -d switch.
- X
- X Similarly, it sets protection bits (flags) to those of source and
- X any file comment will be copied. To avoid this use -p. The archive
- X bit is always cleared.
- X
- X Another useful option is the -u (update) mode were copy will not
- X copy any files which exists already in the destination directory
- X if the destination file is newer or equal to the source file.
- X This is useful when developing code say in ram: eg. 'copy *.c ram:'
- X when done you can copy -u ram: df1: and only those modules you have
- X modified will be copied back.
- X
- X Copy command will now create the destination directory if it does
- X not exist when specified as 'copy [-r] dir dir'. If you specify
- X copy file file file dir, then 'dir' must already exist.
- X
- X CP
- X Equivalent to copy.
- X
- X DATE
- X Usage : date [-sr] [new date and/or time]
- X Example : date Wednesday # this refers to NEXT wed, of course
- X
- X Used to read or set system date and/or time. All standard options
- X may be used (yesterday, tomorrow, monday, etc.).
- X Leading zero's are not necessary.
- X Without parameters shows Dddddd DD-MMM-YY HH:MM:SS.
- X Options:
- X -s stores the current time
- X -r shows time relative to last stored in secs and hunderths
- X
- X DEC
- X Usage : dec varname [value]
- X Example : dec abc
- X
- X Decrement the numerical equivalent of the variable with specified
- X value (default: 1) and place the ASCII-string result back into
- X that variable.
- X
- X DELETE (RM)
- X Usage : delete [-p][-r] file file file...
- X Example : delete foo.txt test.c
- X
- X Remove (delete) the specified files. Remove always returns
- X errorcode 0. You can remove empty directories. The '-r' option
- X will remove non-empty directories by recursively removing all sub
- X directories.
- X You can remove delete-protected files specifying -p option.
- X If you specify any wildcard deletes the files will be listed as
- X they are deleted. This can be suppressed by redirecting to nil:
- X
- X DIR (LS)
- X Usage : dir [-abcdfhiklnoqstuv] [path path ... ]
- X Example : dir -ts downloads:
- X
- X Options:
- X -d list directories only
- X -f list files only
- X -h list only files which not start with a dot, end with '.info' or
- X have the h-flag set.
- X -s short multi(4) column display.
- X -c don't change colors for directories
- X -q quiet display. does not show length in blocks
- X -o display file nOtes
- X -n display names only
- X -a shows the age of all files in the format days hours:minutes
- X -i identifies every file, shows the type instead of the date.
- X See chapter XIV CLASSES
- X -v (viewdir) recursively sums up lengths of the files in a dir
- X -l sorts the files by their length, longest first.
- X -t sorts the files by their time, most recent first.
- X -k sorts the files by their class (klass)
- X -b sorts the files backwards.
- X -u must be given exactly two directories. Shows files only in
- X the first directory, files in both and files in the second.
- X
- X Displays a directory of specified files. Default output shows
- X date, protection, block size, byte size and total space used.
- X Protections flags include new 1.2/1.3 flags (see under protect),
- X plus a 'c' flag which indicates that this file has a comment.
- X Files are alphabetically sorted, without case sensitivity, and
- X directories are in red pen (unless you use -c). Dir takes in
- X account the width of your window.
- X
- X DISKCHANGE
- X Usage : diskchange drive
- X
- X Like AmigaDOS diskchange.
- X
- X ECHO
- X Usage : echo [-en] string
- X Example : echo hi there
- X Results : hi there
- X
- X Echo the string given. If -n switch given no newline is
- X appended. If -e is on, echo to stderr.
- X
- X ELSE
- X Usage : else ; command
- X Usage : if -f foo.c ; else ; echo "Not there" ; endif
- X
- X Else clause, must follow an IF statement.
- X
- X ENDIF
- X Usage : endif
- X
- X The end of an if statement.
- X
- X Note: if you return from a script file with unterminated IF's
- X and the last IF was false, prompt will be changed to an
- X underscore ('_') and no commands will be executed until
- X 'endif' is typed.
- X
- X EXEC
- X Usage : exec command [args]
- X Example : set util SYS:sytem/utilities
- X exec $util/make # would not work without exec
- X
- X Execute the command specified; exec command is equivalent to
- X command, only you can use variables to specify command name.
- X Note that the command line is parsed TWICE, so the commands
- X set a dir ram:; exec $a # right
- X works fine, but
- X set a mkdir; exec $a "My directory" # wrong!
- X would create two directories. Also note that exec always has
- X the return value 0.
- X
- X FAULT
- X Usage : fault error1 .. errorN
- X Example : fault 205 212
- X
- X Like AmigaDOS fault, prints specified error messages.
- X
- X FILENOTE
- X Usage : filenote file1 .. fileN note
- X filenote -s file1...fileN
- X
- X The first form sets AmigaDOS comment of the specified file.
- X The second form display the file notes of the given files.
- X
- X FLIST
- X Usage : flist
- X
- X Lists the filenumbers of files opened by open.
- X See open and close for more info.
- X
- X FLTLOWER
- X Usage : fltlower
- X Example : dir | fltlower
- X Or : fltlower <readme
- X
- X This is a filter command, i.e. it reads from stdin and writes to
- X stdout. The more natural way to use it is a pipe, or it can be
- X redirected.
- X Its purpose is to convert all alphabetic to lower case.
- X
- X FLTUPPER
- X The same of fltlower, only this converts to upper case.
- X
- X FOREACH
- X Usage : foreach [-v] varname ( strings ) command
- X Example : foreach i ( a b c d ) "echo -n $i;echo \" ha\""
- X Result : a ha
- X b ha
- X c ha
- X d ha
- X
- X 'strings' is broken up into arguments. Each argument is placed in
- X the variable 'varname' in turn and 'command' executed. To execute
- X multiple commands, place them in quotes.
- X
- X Foreach is especially useful when interpreting passed arguments in
- X an alias.
- X
- X eg.
- X foreach i ( *.pic ) viewilbm $i
- X assuming a.pic and b.pic in current directory the following commands
- X will occur:
- X viewilbm a.pic
- X viewilbm b.pic
- X
- X Flag -v causes arguments to be displayed every time command is
- X executed.
- X
- X FOREVER
- X Usage : forever command
- X or : forever "command;command;command..."
- X
- X The specified commands are executed over and over again forever.
- X
- X -Execution stops if you hit ^C
- X -If the commands return with an error code.
- X
- X FORLINE
- X Usage : forline var filename command
- X or : forline var filename "command;command..."
- X Example : forline i RAM:temp "echo line $_linenum=$i"
- X
- X For each ASCII line of file specified commands are executed and
- X var points to line content. You can check system variable _linenum
- X to find the number of the line currently read.
- X
- X FORNUM
- X Usage : fornum [-v] var n1 n2 command
- X or : fornum [-v] -s var n1 n2 step command
- X Example : fornum -v x 1 10 echo $1
- X or : fornum -s x 10 1 -1 echo $i # counts backwards
- X
- X Executes command(s) for all numerical values of x between n1 and
- X n2. If more than one command is specified, or command is
- X redirected, include command(s) in quotes.
- X Switch -v (verbose) causes printing of progressive numbers.
- X Switch -s allows you to specify a step; if this is negative, the
- X count will be backwards.
- X
- X GETENV
- X Usage : getenv [shellvar] envvar
- X
- X Gets the value of an ARP or ENV: variable (ARP list searched first)
- X and stores it in the shell variable 'shellvar'. If shellvar is
- X omitted, the value of the ENV: variable is printed to stdout.
- X
- X GOTO
- X Usage : goto label
- X Example :
- X label start
- X echo "At start"
- X dir ram:
- X goto start
- X
- X Goto the specified label name. You can only use this command from
- X a source file. Labels may be forward or reverse from current
- X position. It is legal to jump out of if's.
- X
- X HEAD
- X Usage : head filename [num]
- X Example : head readme 20
- X
- X Display first "num" lines of "filename". If num is not specified,
- X 10 is assumed.
- X
- X HELP
- X Usage : help
- X Example : help
- X
- X Simply displays all the available commands. The commands are
- X displayed in search-order. That is, if you give a partial name the
- X first command that matches that name in this list is the one
- X executed. Generally, you should specify enough of a command so
- X that it is completely unique.
- X
- X HISTORY
- X Usage : history [partial_string]
- X Example : history
- X
- X Displays the enumerated history list. The size of the list is
- X controlled by the _history variable. If you specify a partial
- X string, only those entries matching that string are displayed.
- X
- X HOWMANY
- X Usage : howmany
- X
- X This command tells you how many instances of Shell are running in
- X your system.
- X
- X HTYPE
- X Usage : htype file1 .. filen
- X
- X Displays the specified files in hex and ASCII, just like the system
- X command Type file opt h. Especially suitable for binary files.
- X
- X IF
- X Usage : if [-n] argument conditional argument ;
- X or : if [-n] argument
- X or : if [-n] -f file
- X or : if [-n] -d file/dir
- X or : if [-n] -m
- X or : if [-n] -t file file1 .. fileN
- X or : if [-n] -r rpnexpression
- X or : if [-n] -v varname
- X
- X If a single argument is something to another argument. Conditional
- X clauses allowed:
- X
- X <, >, =, and combinations (wire or). Thus <> is not-equal, >=
- X larger or equal, etc...
- X
- X If arguments are not numeric, they are compared as strings.
- X
- X Usually the argument is either a constant or a variable ($varname).
- X
- X The second form if IF is conditional on the existance of the argument.
- X If the argument is a "" string, then FALSE, else TRUE.
- X
- X The third form of IF used by -f switch checks for existance of
- X the specified file.
- X
- X Switch -d tests the type of the object specified: if it is a
- X directory, then TRUE; if it is a file (or it doesn't exist)
- X then FALSE.
- X
- X Switch -m is used to test if FAST memory is present.
- X Example (to be included in a login.sh file):
- X if -m; resident -d lc1 lc2 blink; endif
- X
- X Using -t form compares the date and time of the first file with
- X all the others; if the first is younger than ALL the others, then
- X FALSE, else TRUE. If a file doesn't exists, it is considered as
- X being older.
- X This feature is especially useful for building makefiles without
- END_OF_FILE
- if test 34966 -ne `wc -c <'shell.doc.aa'`; then
- echo shar: \"'shell.doc.aa'\" unpacked with wrong size!
- fi
- # end of 'shell.doc.aa'
- fi
- echo shar: End of archive 6 \(of 6\).
- cp /dev/null ark6isdone
- MISSING=""
- for I in 1 2 3 4 5 6 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 6 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
- Mail comments to the moderator at <amiga-request@uunet.uu.net>.
- Post requests for sources, and general discussion to comp.sys.amiga.misc.
-